<!--
 * @Description: svg组件
 * @Author: wlj
 * @Date: 2022-12-26 09:33:37
 * @LastEditors: wlj
 * @LastEditTime: 2023-01-03 18:29:29
 * @FilePath: \my-vite-app\src\components\global\SvgIcon.vue
-->
<template>
  <svg :class="svgClass" area-hidden="true">
    <use :xlink:href="iconClassName" :fill="color"></use>
  </svg>
</template>
<script setup lang="ts">
// import { computed } from "vue";
const props = defineProps({
  iconName: {
    type: String,
    required: true,
  },
  className: {
    type: String,
    default: "",
  },
  color: {
    type: String,
    default: "#409eff",
  },
});

const iconClassName = computed(() => {
  return `#${props.iconName}`;
});

const svgClass = computed(() => {
  if (props.className) {
    return `svg-icon ${props.className}`;
  }
  return "svg-icon";
});
</script>
<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  position: relative;
  fill: currentColor;
  vertical-align: -2px;
}
</style>
